<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

/**
 * 1:1문의내역 컨트롤러
 */
class Qna_history extends CI_Controller {
	
	var $data = array();
	
	function __construct() {
		parent::__construct();
		$this->data['sess_userinfo'] = $this->session->userdata('userinfo');

		$this->load->model('bbs/Bbs_model', 'bbs');
		$this->load->helper(array('pagenavi'));
	}

	// Default
	function index() {
		log_message('debug', "@@@@ Payment_history::index()");
		
		$search_type    = $this->input->get('search_type', TRUE);
		$search_keyword = $this->input->get('search_keyword', TRUE);
		$page           = $this->input->get('page', TRUE);

		$search_type    = empty($search_type) ? '' : $search_type;
		$search_keyword = empty($search_keyword) ? '' : $search_keyword;
		$current_page   = empty($page) ? 1 : $page;

		$page_size  = BBS_PAGE_SIZE;		// 한 페이지에 보여줄 글 수
		$block_size = BBS_BLOCK_SIZE;	// 네비영역의 한 블록에 보여줄 페이지 수

		$total_cnt  = $this->bbs->get_bbs_total_count('qna', 'N', 'N', $search_type, $search_keyword, $this->data['sess_userinfo']['user_id']);	// 총 글 수

		$this->data['list'] = $this->bbs->select_bbs_list('qna', 'N', 'N', $search_type, $search_keyword, $current_page, $page_size, $this->data['sess_userinfo']['user_id']);

		$uri = $this->uri->uri_string()."?";
		$this->data['navi'] = page_navigation($current_page, $total_cnt, $page_size, $block_size, $uri);
		
		// 검색 URL (뷰단에서 SCRIPT_NAME이 먹질 않아서 여기에서 셋팅한다.)
		$this->data['uri'] = '/'.$this->uri->uri_string();
		
		// 내용 보기 URL
		$this->data['read_url'] = "/bbs/qna/read?page=$page&idx=";

		for ($i=0; $i < count($this->data['list']); $i++) { 
			$this->data['list'][$i]['reply_list'] = $this->bbs->select_bbs_reply_list($this->data['list'][$i]['idx']);
			$this->data['list'][$i]['file'] = $this->bbs->select_bbs_file_list($this->data['list'][$i]['idx']);
		}
		
		// 가입상품 요약 정보
		$this->load->model('mypage/Member_model', 'member', TRUE);
		$data['summary'] = $this->member->get_summary($this->data['sess_userinfo']['user_id']);
		$this->data['INC_SUMMARY'] = $this->load->view('inc/summary_v', $data, TRUE);
		
		$this->load->view('mypage/qna_history_v', $this->data);
	}
}

/* End of file qna_history.php */
/* Location: ./application/controllers/mypage/qna_history.php */